fix(filesystem): warn when trying to delete an already deleted file
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 24 Apr 2025 08:27:41 +0000 (10:27 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Thu, 24 Apr 2025 09:18:11 +0000 (09:18 +0000)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/common/filesystembase.cpp

index 441746aae0e59bc54f496ab60d8ed2e222f94df0..fafd0eeba61be23a8f482f46bdc4f81922cfd280 100644 (file)
@@ -540,6 +540,11 @@ bool FileSystem::remove(const QString &fileName, QString *errorString)
     // allow that.
     setFileReadOnly(fileName, false);
 #endif
+    const auto deletedFileInfo = QFileInfo{fileName};
+    if (!deletedFileInfo.exists()) {
+        qCWarning(lcFileSystem()) << fileName << "has been already deleted";
+    }
+
     QFile f(fileName);
     if (!f.remove()) {
         if (errorString) {